/**
 * 
 */
package edu.jhu.tcj.purfuit.utils;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

/**
 * @author Bobby
 * This class will load the Categories.properties file into a 
 * usable java bean object. This class should be used during the
 * initialization of the game.
 */
public class LoadConfig {
	/**
	 * Returns a GameConfig object used in initialization of the game.
	 * @return GameConfig
	 */
	public static GameConfig loadGameConfig(){
		GameConfig gameConfig = new GameConfig();
		Properties props = new Properties();
		try {
			props.load(new FileInputStream("conf/Categories.properties"));
		}catch (IOException e) {
			e.printStackTrace();
		}
		
		gameConfig.setCategory1(props.getProperty("category1.type"));
		gameConfig.setCategory2(props.getProperty("category2.type"));
		gameConfig.setCategory3(props.getProperty("category3.type"));
		gameConfig.setCategory4(props.getProperty("category4.type"));
		
		gameConfig.setColor1(props.getProperty("category1.color"));
		gameConfig.setColor2(props.getProperty("category2.color"));
		gameConfig.setColor3(props.getProperty("category3.color"));
		gameConfig.setColor4(props.getProperty("category4.color"));
		
		return gameConfig;
	}
	
	public static void main(String[] args) {
		GameConfig game = LoadConfig.loadGameConfig();
		System.out.println(game.toString());
	}
}
